﻿Public Class SoftWare

    Private _cy As CSoftWare
    Private _path As String = ""
    Public WriteOnly Property 软件() As CSoftWare
        Set(ByVal value As CSoftWare)
            lblTitle.Text = value.Name
            lblDescription.Text = value.Description
            Dim path1 As String = Util.GetCurrentExePath(value.FilePath, CInt(value.FilePathType))
            _path = path1
            If System.IO.File.Exists(path1) Then
                pb.Image = Util.GetExeIcon(path1)
            End If
            lblSize.Text = Util.GetExeSize(path1)
            _cy = value
        End Set
    End Property

    Private Sub lblAuto_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblAuto.Click

        If System.IO.File.Exists(_path) Then
            System.Diagnostics.Process.Start(_path)
        End If

    End Sub

    Private Sub lblSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblSave.Click
        Using frm As New SaveFileDialog
            Dim ex As String = System.IO.Path.GetExtension(_path)
            frm.Filter = "*" + ex + "|*" + ex + "|All files(*.*)|*.*"
            If frm.ShowDialog() = DialogResult.OK Then
                System.IO.File.Copy(_path, frm.FileName)
                wys.util.Common.MessageBase.ShowMessage("保存成功")
            End If
        End Using
    End Sub

    Private Sub lblLink_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblLink.Click
        System.Diagnostics.Process.Start("explorer.exe", "/select," & _path)
    End Sub
End Class
